package com.jeesite.modules.digitalize.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jeesite.modules.digitalize.entity.DigitalizeTaskArchive;
import com.jeesite.modules.digitalize.entity.dto.DigitalizeTaskArchiveDTO;
import com.jeesite.modules.digitalize.entity.dto.DigitalizeTaskDelDTO;
import com.jeesite.modules.digitalize.service.DigitalizeTaskArchiveService;
import com.jeesite.modules.digitalize.util.response.ResultVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

/**
 * 数字-任务模块
 *
 * @author makejava
 * @since 2023-11-11 17:05:12
 */
@RestController
@Api(tags = "数字-任务归档文件管理")
@RequestMapping(value = "${adminPath}/digitalize/archive")
public class DigitalizeTaskArchiveController {
    /**
     * 服务对象
     */
    @Resource
    private DigitalizeTaskArchiveService digitalizeTaskArchiveService;

    /**
     * 分页查询所有数据
     *
     * @return 所有数据
     */
    @ApiOperation("列表")
    @GetMapping("/pageList")
    public ResultVo<Page<DigitalizeTaskArchive>> pageList(@Validated DigitalizeTaskArchiveDTO dto) {
        return ResultVo.success(this.digitalizeTaskArchiveService.pageList(dto));
    }

    @ApiOperation("批量删除")
    @PostMapping("/delBatch")
    public ResultVo delBatch(@RequestBody DigitalizeTaskDelDTO dto) {
        return this.digitalizeTaskArchiveService.delBatch(dto);
    }

    /**
     * @date 2023年08月17日 13:56:14
     * @author patronli
     * @Description: 文件下载/返回给前台
     */
    @ApiOperation("文件下载/预览")
    @GetMapping("/download")
    public void download(HttpServletResponse response, Long id) {
        digitalizeTaskArchiveService.downloadFile(response, id);
    }

}

